package com.dd.cloud.common.exception;

import com.dd.cloud.common.enums.ExceptionEnumInterface;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 对外接口统一异常
 *
 * @author vodbook
 */
@NoArgsConstructor
@Getter
public class ZekeAuthException extends RuntimeException {
    private static final long serialVersionUID = 174332448057001746L;

    private ExceptionEnumInterface enumInterface;
    // 状态码
    private int status;
    // 消息
    private String msg;
    //数据
    private Object data;

    public ZekeAuthException(ExceptionEnumInterface enumInterface) {
        super();
        this.enumInterface = enumInterface;
    }

    public ZekeAuthException(ExceptionEnumInterface enumInterface, String msg) {
        super();
        //this.enumInterface = enumInterface;
        //this.enumInterface.setMessage(msg);
        this.status = enumInterface.getMessage().getCode();
        this.msg = enumInterface.setMessage(msg);
    }

    public ZekeAuthException(String errorMsg) {
        super();
        this.msg = errorMsg;
    }

    public ZekeAuthException(int status, String msg) {
        super(msg);
        this.status = status;
        this.msg = msg;
    }

    public ZekeAuthException(int status, Object data, String msg) {
        super(msg);
        this.status = status;
        this.msg = msg;
        this.data = data;
    }
}
